<?php
/**
 * Framework_Component_Header
 *
 * @author      Ian Szewczyk <roamzero@gmail.com>
 * @copyright   (c) 2007 Ian Szewczyk. All rights reserved.
 * @license http://www.opensource.org/licenses/bsd-license.php
 * @package Framework
 * @subpackage Component
 * @filesource
 */

/**
 * Framework_Component_Header
 *
 *
 * @author Ian Szewczyk <roamzero@gmail.com>
 * @package Framework
 * @subpackage Component
 */
class Framework_Component_Header extends Framework_Component_Common
{
	
	/**
     * $cssFile
     *
     * @access      private
     * @var         string		$cssFile      Name of the primary CSS file
     */
	private $cssFile = 'default.css';
	
	/**
     * $skinDir 
     *
     * @access      private
     * @var         string		$skinDir      Skin directory to point to in the htdocs folder
     */
	private $skinDir = 'Default';
	
	/**
	 * __construct
	 *
	 * @access 		public
	 * @param 		array		$params		Parameters passed from template
	 * @return 		void
	 */
	public function __construct($params = null)
	{
		parent::__construct($params);
		
		if ($this->params['template']) {
			$this->tplFile = $this->params['template'];
		} else { 
			$this->tplFile = 'Header.tpl';
		}
		
		$this->folder = 'Header';

	}

	/**
	 * run
	 *
	 * @access 		public
	 * 
	 * @return 		void
	 */
	public function run()
	{
		$owner = Framework_Owner::singleton(); 
		
		if ($owner->isValid) {
			// get CSS file
			if ($owner->cssFile) {
				$this->cssFile = $owner->cssFile;
			}
			
			$customCSS = $owner->getCustomCSS();
			if($customCSS) {
				$this->setData('customCSS', $customCSS);
			}
			
			$customHeader = $owner->getCustomHeader();
			if($customHeader) {
				$this->setData('customHeader', $customHeader);
			}
			
			if($owner->skin) {
				$this->skinDir = $owner->skin;
			}
			
			if($owner->avatarURL) {
				$this->setData('avatarURL' , $owner->avatarURL);
			}
			  
		}
		
		
		
		$this->setData('cssFile' , $this->cssFile);
		$this->setData('skinDir' , $this->skinDir);
	}

	
	/**
	 * __destruct
	 *
	 * @access 		public
	 * 
	 * @return 		void
	 */
	public function __destruct()
	{
		parent::__destruct();
	}
}

?>